<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>12-CSS尺寸</title>
    <script>
        window.onload = function () {
            let imgEle = document.getElementsByTagName("img")[0];
            let clientWidth = imgEle.clientWidth;
            let clientHeight = imgEle.clientHeight;
            document.getElementById("btn").onclick=function () {
                alert("宽："+clientWidth+"px,高："+clientHeight+"px");
            }
        }
    </script>
</head>
<body>
<img src="../images/静态表情包4.jpg" alt="">
<button id="btn">点我显示图片宽和高</button>
</body>
</html>